package org.dizena.base.avo.resp;


import lombok.Data;
import lombok.ToString;

@ToString
@Data
public class Result<T>
{
    /**
     * 提示信息
     */
    private String msg;
    /**
     * 状态码
     */
    private Integer code;
    /**
     * 数据对象
     */
    private T data;

    private Result()
    {
        super();
    }

    public Result(Integer code, T data)
    {
        this.code = code;
        this.data = data;
    }

    public Result(Integer code, String msg)
    {
        this.code = code;
        this.msg = msg;
    }


    public static <T> Result<T> success(T data)
    {
        return new Result<T>(200, data);
    }

    public static <T> Result<T> error(Integer code, String msg)
    {
        return new Result<T>(code, msg);
    }

}
